package com.yy.wga.mp.module.income.controller;


import com.yy.wga.mp.module.income.response.IncomeUpGradeGetNotifyResponse;
import com.yy.wga.mp.module.income.response.IncomeUpGradePageResponse;
import com.yy.wga.mp.module.income.request.IncomeOrderConfirmRequest;
import com.yy.wga.mp.module.income.response.IncomeUpGradeParentUserPageResponse;
import com.yy.wga.mp.module.income.service.IncomeUpGradeService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * 直通车大礼包订单收益
 *
 * @author guochao
 * @since 2024-11-12 00:27:45
 */
@RestController
@RequestMapping("/api/income/upgrade")
public class IncomeUpGradeController {
    /**
     * 服务对象
     */
    @Resource
    private IncomeUpGradeService incomeUpGradeService;

    /**
     * 获取收益列表
     * @return
     */
    @PostMapping("list")
    public Result<List<IncomeUpGradePageResponse>> list(@RequestBody @Valid BasePageRequestDTO request) {
        List<IncomeUpGradePageResponse> responseList = incomeUpGradeService.pageIncome(request);
        return Result.success(responseList);
    }

    /**
     * 获取享客订单列表
     * @return
     */
    @PostMapping("parentUserList")
    public Result<List<IncomeUpGradeParentUserPageResponse>> parentUserList(@RequestBody @Valid BasePageRequestDTO request) {
        List<IncomeUpGradeParentUserPageResponse> responseList = incomeUpGradeService.parentUserList(request);
        return Result.success(responseList);
    }

    /**
     * 确定订单
     * @return
     */
    @PostMapping("confirm")
    public Result<Boolean> confirm(@RequestBody @Valid IncomeOrderConfirmRequest request) {
        incomeUpGradeService.confirm(request);
        return Result.success(Boolean.TRUE);
    }

    /**
     * 查询服务商礼包通知
     * @return
     */
    @PostMapping("getNotify")
    public Result<List<IncomeUpGradeGetNotifyResponse>> getNotify() {
        List<IncomeUpGradeGetNotifyResponse> responseList = incomeUpGradeService.getNotify();
        return Result.success(responseList);
    }
}
